package com.crm.service.impl.godluck;

import com.crm.common.util.DateUtils;
import com.crm.dao.mapper.customMapper.godluck.GodLuckRecordCustomMapper;
import com.crm.dao.mapper.godluck.GodLuckRecordMapper;
import com.crm.model.entity.godluck.GodLuckRecord;
import com.crm.model.entity.godluck.GodLuckRecordExample;
import com.crm.service.godluck.GodLuckRecordDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;

/**
 * @Description: 抽签记录service
 * @Author lixq-f
 * @Date 2021/4/13
 * @Version V1.0
 **/
@Service
public class GodLuckRecordDbServiceImpl implements GodLuckRecordDbService {

    @Autowired
    private GodLuckRecordMapper godLuckRecordMapper;
    @Autowired
    private GodLuckRecordCustomMapper recordCustomMapper;


    /**
     * @Description: 添加抽签记录
     * @Param: [record]
     * @Return: java.lang.Boolean
     * @Author: lixq-f
     * @Date: 2021/4/13
     **/
    @Override
    public Boolean addGodLuckRecord(GodLuckRecord record) {
        return godLuckRecordMapper.insertSelective(record) > 0;
    }


    /**
     * @Description: 统计今日抽签人数
     * @Param: []
     * @Return: java.lang.Integer
     * @Author: lixq-f
     * @Date: 2021/5/14
     **/
    @Override
    public Integer statisticsGodLuckNumToday(Date startTm, Date endTm) {
        return recordCustomMapper.statisticsGodLuckNumToday(startTm,endTm);
    }


    /**
     * @Description: 根据创建时间获取前三名头像
     * @Param: []
     * @Return: java.util.List<java.lang.String>
     * @Author: lixq-f
     * @Date: 2021/5/14
     **/
    @Override
    public List<String> getTopThreeByCTime(Date startTm, Date endTm){
        return recordCustomMapper.getTopThreeByCTime(startTm,endTm);
    }


}
